package com.ybzl.gateway.controller;

import com.ybzl.gateway.netty.ChannelGroups;
import io.netty.channel.group.ChannelGroupFuture;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/cmd")
@Slf4j
public class CmdController {

    @GetMapping("find")
    public void find(Integer tagId) {
        String hex = Integer.toHexString(tagId);
        String formattedHex = hex.substring(0, 2) + " " + hex.substring(2);
        log.info("current tagId {}", tagId);
        ChannelGroupFuture broadcast = ChannelGroups.broadcast("59 42 02 " + formattedHex + " 00 00 5A 4C");
    }



}
